Someone who hits the ceiling -- the top of the room -- is violently angry. A wife may hit the ceiling because her husband forgot their wedding anniversary.
Harry was too quick for Neville, whose wand went spinning out of his hand, hit the ceiling in a shower of sparks and landed with a clatter on top of a bookshelf, from which Harry retrieved it with a Summoning Charm.